home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWShape.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.7 KB  |  195 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWShape.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSHAPE_H
  11. #define FWSHAPE_H
  12.  
  13. #ifndef FWPOINT_H
  14. #include "FWPoint.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. #ifndef SLGRDEF_H
  22. #include "SLGrDef.h"
  23. #endif
  24.  
  25. #ifndef FWINK_H
  26. #include "FWInk.h"
  27. #endif
  28.  
  29. #ifndef FWSTYLE_H
  30. #include "FWStyle.h"
  31. #endif
  32.  
  33. #ifndef FWFONT_H
  34. #include "FWFont.h"
  35. #endif
  36.  
  37. #ifndef FWSTDDEF_H
  38. #include "FWStdDef.h"
  39. #endif
  40.  
  41. // ----- Foundation Includes -----
  42.  
  43. #ifndef FWEXCLIB_H
  44. #include "FWExcLib.h"
  45. #endif
  46.  
  47. //========================================================================================
  48. //    Forward Declarations
  49. //========================================================================================
  50.  
  51. class FW_CGraphicContext;
  52. class FW_CReadableStream;
  53. class FW_CWritableStream;
  54.  
  55. //========================================================================================
  56. //    class FW_CShape
  57. //========================================================================================
  58.  
  59. class FW_CShape
  60. {
  61. public:
  62.     FW_DECLARE_CLASS
  63.     FW_DECLARE_AUTO(FW_CShape)
  64.  
  65. //----------------------------------------------------------------------------------------
  66. //    Constructors/Destructors
  67. //
  68. public:
  69.     virtual ~ FW_CShape();
  70.  
  71. protected:
  72.     FW_CShape(FW_ERenderVerbs renderVerb,
  73.               const FW_CInk& ink,
  74.               const FW_CStyle& style,
  75.               const FW_CFont& font);
  76.  
  77.     FW_CShape(const FW_CShape& other);
  78.     FW_CShape(FW_CReadableStream& stream);
  79.  
  80. //----------------------------------------------------------------------------------------
  81. //    Operators
  82. //
  83. public:
  84.     FW_CShape& operator=(const FW_CShape& other);
  85.  
  86. //----------------------------------------------------------------------------------------
  87. //    New API
  88. //
  89. public:
  90.     // ----- Memory Management -----
  91.     virtual void                Purge();
  92.  
  93.     // ----- Rendering -----
  94.     virtual void                 Render(FW_CGraphicContext& gc) const = 0;
  95.     
  96.     // ----- Hit Testing -----
  97.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  98.                                         const FW_CPoint& test,
  99.                                         FW_Fixed tolerance) const = 0;
  100.     
  101.     // ----- Copying -----
  102.     virtual FW_CShape*            Copy() const = 0;
  103.     
  104.     // ----- Transform -----
  105.     virtual void                Transform(Environment *ev, ODTransform* transform) = 0;
  106.     virtual void                InverseTransform(Environment *ev, ODTransform* transform) = 0;
  107.  
  108.     virtual void                MoveShape(FW_Fixed deltaX, FW_Fixed deltaY) = 0;
  109.     virtual void                MoveShapeTo(FW_Fixed x, FW_Fixed y) = 0;
  110.     
  111.     virtual void                Inset(FW_Fixed h, FW_Fixed v) = 0;
  112.     
  113.     // ----- Bounds -----
  114.     virtual void                 GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const = 0;
  115.     
  116.     // ----- Anchor Points -----
  117.     virtual FW_CPoint            GetAnchorPoint() const = 0;
  118.     
  119.     // ----- Archiving -----
  120.     virtual void                Flatten(FW_CWritableStream& stream) const;
  121.     static void                 Write(FW_CWritableStream& stream, FW_ClassTypeConstant type, const void *object);
  122.     
  123.     // ----- Getters/Setters -----
  124.     FW_ERenderVerbs                GetRenderVerb() const
  125.                                     {return fRenderVerb;}
  126.     virtual void                SetRenderVerb(FW_ERenderVerbs renderVerb);
  127.                         
  128.     // ----- Ink access -----
  129.     FW_CInk&                    GetInk()
  130.                                     {return fInk;}
  131.  
  132.     const FW_CInk&                GetInk() const
  133.                                     {return fInk;}
  134.  
  135.     FW_CInk&                    GetUnSharedInk();
  136.                                     
  137.     virtual void                SetInk(const FW_CInk& newInk);
  138.  
  139.     void                        GetForeColor(FW_CColor& color) const
  140.                                     {fInk.GetForeColor(color);}
  141.  
  142.     void                        GetBackColor(FW_CColor& color) const
  143.                                     {fInk.GetBackColor(color);}
  144.  
  145.     FW_TransferModes            GetTransferMode() const
  146.                                     {return fInk.GetTransferMode();}
  147.  
  148.     // ----- Style access -----
  149.     FW_CStyle&                    GetStyle()
  150.                                     {return fStyle;}
  151.  
  152.     const FW_CStyle&            GetStyle() const
  153.                                     {return fStyle;}
  154.  
  155.     FW_CStyle&                    GetUnSharedStyle();
  156.  
  157.     virtual void                SetStyle(const FW_CStyle& newStyle);
  158.     
  159.     FW_Fixed                    GetPenSize() const
  160.                                     {return fStyle.GetPenSize();}
  161.  
  162.     FW_CPattern                    GetPattern() const
  163.                                     {return fStyle.GetPattern();}
  164.  
  165.     // ----- Font access -----
  166.     FW_CFont&                    GetFont()
  167.                                     {return fFont;}
  168.  
  169.     const FW_CFont&                GetFont() const
  170.                                     {return fFont;}
  171.  
  172.     FW_CFont&                    GetUnSharedFont();
  173.  
  174.     virtual void                SetFont(const FW_CFont& newFont);
  175.     
  176.     FW_Fixed                     GetFontSize() const
  177.                                     {return fFont.GetFontSize();}
  178.  
  179.     FW_FontStyle                 GetFontStyle() const
  180.                                     {return fFont.GetFontStyle();}
  181.  
  182.     void                        GetFontName(FW_CString& fontName) const
  183.                                     {fFont.GetFontName(fontName);}
  184. //----------------------------------------------------------------------------------------
  185. //    Data Members
  186. //
  187. protected:
  188.     FW_ERenderVerbs                fRenderVerb;
  189.     FW_CInk                        fInk;
  190.     FW_CStyle                    fStyle;
  191.     FW_CFont                    fFont;
  192. };
  193.  
  194. #endif
  195.